// dlgAddBook.cs
//
//  Copyright (C) 2007 BOUTRY Arnaud arnaud@lordphoenix.info
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License version 2.1 as published by the Free Software Foundation; 
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
//
//

using System;

namespace biblix
{
	
	
	public partial class dlgAddBook : Gtk.Dialog
	{
		private booklist mybase;
		
		public book newbook;
		
		public dlgAddBook(booklist workingbase)
		{
			this.Build();
			mybase = workingbase;
			foreach(string genre in mybase.GetGenreList())
				cbxGenre.AppendText(genre);
			newbook = new book();
		}

		protected virtual void OnBtnOKClicked (object sender, System.EventArgs e)
		{
			newbook.titre = entTitle.Text;
			newbook.auteur = entAuteur.Text;
			newbook.serie = entSerie.Text;
			newbook.genre = cbxGenre.ActiveText;
			newbook.volume = spbTome.ValueAsInt;
			newbook.note = spbNote.ValueAsInt;
			newbook.lu = ckbLu.Active;
			newbook.pret = ckbPret.Active;
			newbook.publishyear = entPublication.Text;
		}

		protected virtual void OnBtnCancelClicked (object sender, System.EventArgs e)
		{
			newbook = null;
		}

	}
}
